package TransactionImplementation

import (
	"SPC/Database"
	"SPC/ModelImplementation"
	"fmt"
	"time"
)

type ServiceChargeTransaction struct {
	itsDate     time.Time
	itsCharge   float64
	itsMemberId int
}

func NewServiceChargeTransaction(memberId int, date time.Time, charge float64) *ServiceChargeTransaction {
	return &ServiceChargeTransaction{
		itsMemberId: memberId,
		itsDate:     date,
		itsCharge:   charge,
	}
}

func (s *ServiceChargeTransaction) Execute() {
	e := Database.GetPayrollDatabase().GetUnionMember(s.itsMemberId)
	af := e.GetAffiliation()
	fmt.Println(af)
	uaf := ModelImplementation.GetUnionAffiliation()
	uaf.AddServiceCharge(s.itsDate, s.itsCharge)

}
